clear all
set	more off

cd "~/Dropbox/ors_quality_R01"
use "data/KDG/know_do_gap.dta", clear

	
	*creating new variables for labeling purposes
	
	gen ors_pref = sp_type_cod==1
	gen anti_pref = sp_type_code==2
	gen no_pref = sp_type_code==3
	gen noincentive = sp_type_code==4
	gen supply = treatment
	
	
	label var  ors_pref "ORS Preference vs. Antibiotics Preference"
	label var  no_pref "No Preference vs. Antibiotics Preference"
	label var  anti_pref "Antibiotics Preference"
	label var  noincentive "No Financial Incentive"
	label var  supply "Given ORS supply"	

	
**************
*** Pooled ***
**************

	*extracting control mean
	sum rec_anti if sp_type==2
	local cntl_mean = r(mean)
	
	reg rec_anti ors_pref no_pref noincentive supply, cluster(town_code)
	outreg2 using "tables/pref_anti", tex replace dec(3) ///
	nocons nor2 nonotes label ///
	ctitle("Change In Antibiotics Prescribing") ///
	keep(ors_pref no_pref) ///
	adds(Mean in antibiotic preference arm, `cntl_mean') /// 
	addtext(Controls, No) 
	
	*extracting control mean
	sum rec_anti if sp_type==2 & know_anti==1
	local cntl_mean = r(mean)
	
	reg rec_anti ors_pref no_pref noincentive supply if know_anti==1, cluster(town_code)
	outreg2 using "tables/pref_anti", tex dec(3) ///
	nocons nor2 nonotes label ///
	ctitle("Change In Know-Do Gap") ///
	keep(ors_pref no_pref) ///
	adds(Mean in antibiotic preference arm, `cntl_mean') /// 
	addtext(Controls, No) 

	
